import { ref } from 'vue'

export const useDialog = () => {
  const dialogVisible = ref(false)
  const dialogTitle = ref('')

  const openDialog = (title?: string) => {
    dialogVisible.value = true
    if (title) {
      dialogTitle.value = title
    }
  }

  const closeDialog = () => {
    dialogVisible.value = false
  }

  return {
    dialogVisible,
    dialogTitle,
    openDialog,
    closeDialog
  }
}
